<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //面向过程编程
    // const uname = '曾鹏'
    // const birth = 2000
    // const age = new Date().getFullYear() - birth
    // console.log(`我是${uname},今年${age}`)

    //面向函数编程
    function sayHi(name, birth) {
      function getAge() {
        return new Date().getFullYear() - birth
      }
      console.log(`我是${name},今年${getAge()}`)
    }
    sayHi('曾鹏', 2002)
    sayHi('谢志欢', 2000)

    //面向对象编程
    // class Person {
    //   constructor(unaem, birth) {
    //     this.unaem = unaem
    //     this.birth = birth
    //   }
    //   getAge() {
    //     return new Date().getFullYear() - this.birth
    //   }
    //   sauHi() {
    //     console.log(`我是${this.unaem},今年${this.getAge()}`)
    //   }
    // }
    // const user = new Person('曾鹏', 2002)
    // user.sauHi()
  </script>
</body>

</html>